using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Cd : MonoBehaviour
{
    private short c;

    public GameObject cursor;
    public Sprite gold_cursor;

    // Start is called before the first frame update
    void Start()
    {
        c = 0;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.anyKeyDown)
        {
            switch (c)
            {
                case 0:
                case 1:
                    if (Input.GetKeyDown(KeyCode.UpArrow)) c++;
                    else c = 0;
                    break;
                case 2:
                case 3:
                    if (Input.GetKeyDown(KeyCode.DownArrow)) c++;
                    else c = 0;
                    break;
                case 4:
                case 6:
                    if (Input.GetKeyDown(KeyCode.LeftArrow)) c++;
                    else c = 0;
                    break;
                case 5:
                case 7:
                    if (Input.GetKeyDown(KeyCode.RightArrow)) c++;
                    else c = 0;
                    break;
                case 8:
                    if (Input.GetKeyDown(KeyCode.B)) c++;
                    else c = 0;
                    break;
                case 9:
                    if (Input.GetKeyDown(KeyCode.A)) c++;
                    else c = 0;
                    break;
                default:
                    c = (short)(c == 10 ? 0 : 10);
                    break;
            }
        }
    }

    private void FixedUpdate()
    {
        if (c == 0xA)
        {
            CursorMove.isDead = false;
            cursor.GetComponent<SpriteRenderer>().sprite = gold_cursor;
        }
    }
}
